import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';

@Component({
  selector: 'favorite',
  templateUrl: './favorite.component.html',
  styleUrls: ['./favorite.component.css']
})
export class FavoriteComponent {
  @Input('isFavorite') isFavorite: boolean;
  @Output('change') change = new EventEmitter();
  
  glyphicon = 'glyphicon glyphicon-star-empty';
  
  onChangeStar() {
    this.isFavorite = !this.isFavorite;
    this.glyphicon = this.isFavorite ? "glyphicon glyphicon-star" : "glyphicon glyphicon-star-empty";
    this.change.emit({newVaule: this.isFavorite })
  }
}
